package com.lw.system.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lw.common.basemodel.Json;
import com.lw.common.web.controller.base.BasicController;
import com.lw.common.web.util.LoginHelper;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
 
/**
 * 
 * @Title: LoginController.java
 * @Package com.lw.controller
 * @Description: 登录控制器
 * @author 刘伟 15818570028@163.com
 * @date 2016年12月23日 上午8:53:32
 * @version V1.0
 */
@RestController
@RequestMapping("/login")
@Api(value = "login")
public class LoginController extends BasicController {
 
    @ApiOperation(value = "登录", notes = "登录已經加密")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public Json login(@ApiParam(value = "用户名或手机号") @RequestParam String loginName,
            @ApiParam(value = "密码") @RequestParam String password) {
        return setSimpleSuccess(LoginHelper.login(loginName, password));
    }
 
    @ApiOperation(value = "退出系统", notes = "退出系统")
    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    public Json logout() {
        LoginHelper.logout();
        return setSimpleSuccess();
    }
 
}